/*
 * main.c
 *
 *  Created on: Feb 26, 2013
 *      Author: ostan
 */


#include <avr/io.h>
#include <util/delay.h>

#include "buttons.h"
#include "leds.h"
#include "motors.h"

int main(void) {
	LED_init();
	Motors_init();
	Buttons_init();

	LED_toggle(0);
	while(1) {


		//LED_toggle(0);
		//LED_toggle(1);

		int speed = 0;

		if (isButtonPressed(0)) {
			speed = 1;
			LED_on(0);
		} else {
			LED_off(0);
			if(isButtonPressed(1)) {
				speed=-1;
			} else {
				speed = 0;
			}
		}

		int i;
		for(i=0; i<6; i++)
			SetMotorSpeed(i, speed);

		Motor_task();
	}

	return 0;
}
